<template>
  <div>
    <div v-for="(item,index) in list" :key="index + 'ss'" style="margin-bottom:20px">
      <div style="margin-bottom:20px;text-align: center">
        {{item.title}}检测项目信息表
      </div>
      <checkTable :table-head="item.place_conditions_infos"
                  :table-list="tableTitle.stability_sample_info" :table-data="datass[item.id]" />
    </div>
  </div>
</template>

<script>
import checkTable from './checkTable'
  export default {
    name: 'checkTitle',
    components:{
      checkTable
    },
    props: {
      tableTitle: {
        type: Object,
        default: function() {
          return {
            stability_sample_info: {},
            inspect_types: []
          };
        }
      },
      datass: {
        type: Object,
        default: function() {
          return {};
        }
      }
    },
    data() {
      return {
        sample_name: "",
        inspect_type_name: "",
        list: []
      }
    },
    //是计算属性，也可以理解为一个方法。
    computed: {},

    //属性是手动定义的所需监听的值
    watch: {},

    //生命周期 - 创建完成（访问当前this实例）
    created() {
    },

    //生命周期 - 挂载完成（访问DOM元素）
    mounted() {
      let title;
      this.tableTitle.inspect_types.forEach(element => {
        element.title =
          this.tableTitle.stability_sample_info.sample_name +
          element.inspect_type.inspect_type_name;
        element.id =
          this.tableTitle.stability_sample_info.id + '?' + element.inspect_type.id;
        if (!this.datass[element.id]) {
          let data = {
            tableData: [],
            combined: {},
            total: {}
          };
          this.datass[element.id] = data;
        }
      });
      this.list = this.tableTitle.inspect_types;
    },

    //是Vue实例对象上绑定的方法，供当前Vue组件作用域内使用，
    methods: {}

  }

</script>

<style scoped>
  /* @import url(); 引入css类 */
</style>
